package com.eva.androidlibrary.widget.tabhost;

import android.database.DataSetObservable;
import android.database.DataSetObserver;
import android.view.View;
import android.view.ViewGroup;

/**
 * Class description
 *
 * @author GUXIA318
 * @date 2015-09-16 13:44
 */
public abstract class TabHostLayoutAdapter {

    private final DataSetObservable mDataSetObservable = new DataSetObservable();

    /**
     * How many items are in the data set represented by this Adapter.
     *
     * @return Count of items.
     */
    public abstract int getCount();

    public abstract View getTab(int position, boolean isSelected, View convertView, ViewGroup parent);

    public void registerDataSetObserver(DataSetObserver observer) {
        mDataSetObservable.registerObserver(observer);
    }

    public void unregisterDataSetObserver(DataSetObserver observer) {
        mDataSetObservable.unregisterObserver(observer);
    }

    /**
     * Notifies the attached observers that the underlying data has been changed
     * and any View reflecting the data set should refresh itself.
     */
    public void notifyDataSetChanged() {
        mDataSetObservable.notifyChanged();
    }
}
